from Tkinter import *
from nipponsteel.gui.utils import ProgressBar, StatusBar, quick_app
from nipponsteel.gui.menus import Menus
from nipponsteel.gui.player import Player
from nipponsteel.gui.controls import Controls
from nipponsteel.gui.manager import Manager


class Main(Frame):
    def __init__(self, master, width=800, height=400):
        Frame.__init__(self, master)
        self.rowconfigure(2, weight=1)
        self.columnconfigure(0, weight=1)
        
        self.menus = Menus(self)
        self.menus.grid(row=0, column=0, sticky=NE+SW)
        self.progress = ProgressBar(self, width=width, height=0.05*height)
        self.progress.grid(row=1, column=0, sticky=NE+SW)
        self.player = Player(self, width=width, height=0.95*height)
        self.player.grid(row=2, column=0, sticky=NE+SW)
        self.controls = Controls(self)
        self.controls.grid(row=3, column=0, sticky=NE+SW)
        self.status = StatusBar(self)
        self.status.grid(row=4, column=0, sticky=NE+SW)
        self.manager = Manager(self)
        
        
def StackingApp(width=1200, height=400):
    app = quick_app("Stacking Problem visualizer")
    app.bind("<Configure>", lambda event: app.update_idletasks())
    app.main = Main(app, width, height)
    app.main.grid(row=0, column=0, sticky=NE+SW)
    return app
    